import express from 'express';
const app = express()
const port = 3001

app.get('/', (req, res) => 
{
    res.send("hello word");
});

let server = app.listen(port, () =>
{
    console.log(`http://127.0.0.1:3001`)
});

if (module.hot)
{
    module.hot.accept();
    module.hot.dispose(
        () =>
        {
            server.close();
        }
    );
    module.hot.addStatusHandler(status =>
    {
        if (status === "fail" || status === "abort")
        {
            //重启应用
            process.exit(1);
        }
    });
}
